﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TM.PluginManager
{
    public class BasicPluginManager:IPluginManager
    {
        private Dictionary<string, PackageInfo> _packages = new Dictionary<string, PackageInfo>();

        #region Implementation of IPluginManager

        public bool LoadPackage(string assemblyFilePath, out string error)
        {
            throw new NotImplementedException();
        }

        public void InitializePackage(string packageName)
        {
            throw new NotImplementedException();
        }

        public void ReleasePackage(string packageName)
        {
            if(_packages.ContainsKey(packageName))
            {
                var package = _packages[packageName];
                package.DefaultWindowInstance.Release();
                _packages.Remove(packageName);
                GC.Collect();
            }
        }

        public Dictionary<string, PackageInfo> Packages
        {
            get { return _packages; }
            private set { _packages = value; }
        }

        #endregion
    }
}
